import { z } from 'zod'
import { useReqBody } from '@sker/runtime'
import { useTransaction } from '@sker/core'
const schema = z.array(z.object({
    sql: z.string(),
    params: z.array(z.any())
}))
export default async () => {
    const body = schema.parse(useReqBody())
    const result = await useTransaction(async (manager) => {
        return Promise.all(body.map((b) => manager.query(b.sql, b.params)))
    })
    return result;
}
